package example.demo.customerclassloader;


import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class TestRaoClassLoader {
    public static void main(String[] args) throws Exception {
//        String filePath = "E:\\xiangxue\\framework-learn\\dubbo-simple-use\\dubbo-provider";
        String filePath = "E:\\xiangxue\\framework-learn\\rao-classfile";
        File file = new File(filePath);
        System.out.println("file.getName() = " + file.getName());
//        List<File> files = listFile(file, new ArrayList<>());
//        System.out.println(files);

        RaoClassLoader raoClassLoader = new RaoClassLoader(filePath);
        Class<?> aClass = raoClassLoader.loadClass("example.demo.Rao");
        System.out.println("aClass = " + aClass);
        System.out.println("aClass.getClassLoader() = " + aClass.getClassLoader());


    }

    public static List<File> listFile(File file, List<File> files) {
        if (file.isDirectory()) {
            for (File filesrc : file.listFiles()) {
                listFile(filesrc, files);
            }
        } else {
            files.add(file);
            return files;
        }
        return files;
    }
}
